package com.boyinet.imesh2json.model

import com.boyinet.imesh2json.bean.Type
import javafx.beans.property.*

class ProductTypeModel {

    val id: LongProperty = SimpleLongProperty(-1)
    val type: IntegerProperty = SimpleIntegerProperty(0)
    val code: StringProperty = SimpleStringProperty()
    val value: StringProperty = SimpleStringProperty()


    fun fill(entity: Type) {
        id.value = entity.id
        code.value = entity.code
        value.value = entity.value
        type.value = entity.type
    }


    fun export(): Type {
        val current = this
        return Type(current.id.value).apply {
            code = current.code.value
            value = current.value.value
            type = current.type.value
        }
    }
}